<!DOCTYPE html>
<html>
<head>
    <title>Preview Display</title>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="custom/images/favicon.ico?v=2" />
    <style>
        html, body {
            padding: 0px;
            margin: 0px;
        }
    </style>

    <script src='../configs/htconfig.js'></script>
    <script src='../libs/echarts.js'></script>
    <script src='../libs/jquery-3.4.1.min.js'></script>
    <script src='../libs/core/IZrowIfUVaXF.js'></script>
    <script src='../libs/core/VT3MIEkV8AKv.js'></script>
    <script src='../libs/core/ht.js'></script>
    <script src='../libs/core/buckle.js'></script>
    <script src='../libs/core/ht-ui.js'></script>
    <script src='../libs/plugin/ht-edgetype.js'></script>
    <script src='../libs/plugin/ht-obj.js'></script>
    <script src='../libs/plugin/ht-form.js'></script>
    <script src='../libs/plugin/ht-vector.js'></script>
    <script src='../libs/plugin/ht-cssanimation.js'></script> <!--依赖cssanimation插件-->
    <script src='../libs/plugin/ht-dialog.js'></script>
    <script src='../libs/plugin/ht-autolayout.js'></script>

    <script>

        var attributeConfig = {
            url1:"http://172.16.11.150/epplatform",

        };
        var left_tree_model;
        function init() {
            dataModel = new ht.DataModel();
            graphView = new ht.graph.GraphView(dataModel);
            graphView.addToDOM();

            //调取左边树
            getlistEquipmentTree();

            ht.Default.xhrLoad('displays/冀北/台账/台帐管理.json', function(text) {
                var json = ht.Default.parse(text);
                if(json.title) document.title = json.title;
                dataModel.deserialize(json);
                //         graphView.fitContent(true);
                var left_tree_menu = dataModel.getDataByTag("left_tree_menu");
                left_tree_model=left_tree_menu;

//                graphView.addInteractorListener(function (e) {
//                    if ('clickData'==e.kind&&e.data&&e.data.getTag()==='edit-standing-book'){
//                        table1.setEditable(true);
//                    }
//                });

                //表1数据绑定（基本信息）
                var table1 = dataModel.getDataByTag('table1');
                var val1=updateDataModel(attributeConfig.url1+"/v1/equipmentLedger/getStationBaseInfo?stationId=abb0743543f24bc09b30154588010a7f");
                var res = [];
                for(i = 0 ; i < val1.length ; i=i+2){
                    let col= {};
                    col.col1 = val1[i].prop_name;
                    col.col2 =val1[i].prop_value;
                    if(val1[i+1]){
                        col.col3 = val1[i+1].prop_name;
                        col.col4 =val1[i+1].prop_value;
                    }
                    res.push(col);
                }
                table1.a('ht.dataSource',res);

                // 表2数据绑定 （SVG）
//                var table2 = dataModel.getDataByTag('table2');
//                console.log('table2===',table2);
//                var val2=updateDataModel('D:/HT/四楼工作/王康数据/AVG.json');
//                var res2 = [];
//                var res3=new Array();
//                for (var i=0;i<val2.length;i++){
//                    let col2={};
//                    for (var m=0;m<val2[i].length;m++){
//                        col2.col[m]=val2[i][m].prop_value;
//
//                        var obj=new Object();
//                        obj.displayName=val2[i][m].prop_name;
//                        obj.key ='col'+m;
//                        obj.headColor='#000000';
//                        obj.align='center';
//                        res3.push(obj);
//                    }
//                    res2.push(col2);
//                }
//                table2.a('ht.dataSource',res2);
//                table2.a('columns',res3);
            });


            function GetQueryString(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return decodeURI(r[2]);
                return null;
            }


            var values=new Array();
            function updateDataModel(url){
                $.ajax({
                    type : "GET",
                    async : false, //同步请求
                    //   startTime : System.currentTimeMillis() ,
                    //  endTime : System.currentTimeMillis(),
                    url : url,
                    contentType: "application/json; charset=utf-8",
                    success:function(data){

                        if(data.code==0){
                            values = data.data.stationBaseInfo;
                        }
                    },
                    error: function() {
                        alert("失败，请稍后再试！");
                    }
                });
                return  values;
            }



            //获取树菜单
            function getlistEquipmentTree() {
                $.ajax({
                    type: "GET",
                    async: true, //同步请求
                    // startTime : System.currentTimeMillis() ,
                    // endTime : System.currentTimeMillis(),
                    url: attributeConfig.url1 + "/v1/equipmentLedger/listEquipmentTree",
                    contentType: "application/json; charset=utf-8",
                    success: function (data) {

                        console.log('远程数据请求data', data);

                        if (data.code == 0) {
                            left_tree_model.a("treedata", data.data);
                        }
                    },
                    error: function () {
                        console.log("失败，请稍后再试！");
                    }
                });
            }

        }
    </script>
</head>
<body onload='setTimeout(init, 300)'>
<div id="content1" style="width: 50%;"  bordercolor="red" >
    <div><p align="center" style="font-family:arial;color:black;font-size:20px;">新增场站</p></div>
    <hr />
    <br/>
    <div>
        所属区域: <input class="username1" style="font-size: 14px;width:200px;height:20px;">
        所属区域: <input class="username2" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>

    <div>
        所属区域: <input class="username3" style="font-size: 14px;width:200px;height:20px;">
        所属区域: <input class="username4" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>
    <form enctype="multipart/form-data" id="batchUpload"  action="/excel/import" method="post" class="form-horizontal">
        <button class="btn btn-success   btn-xs" id="uploadEventBtn" style="height:26px;"  type="button" >上传</button>
        <input type="file" name="file"   style="width:0px;height:0px;" id="uploadEventFile">
        <input id="uploadEventPath"  disabled="disabled"  type="text" placeholder="请择excel表" style="border: 1px solid #e6e6e6; height: 26px;width: 200px;" />
    </form>
</div>


<div id="content2" style="width: 50%;"  bordercolor="red" >
    <div><p align="center" style="font-family:arial;color:black;font-size:20px;">新增设备</p></div>
    <hr />
    <br/>
    <div>
        场站: <input class="username1" style="font-size: 14px;width:200px;height:20px;">
        设备编号: <input class="username2" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>

    <div>
        设备厂家: <input class="username3" style="font-size: 14px;width:200px;height:20px;">
        设备型号: <input class="username4" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>
    <form enctype="multipart/form-data" id="batchUpload2"  action="/excel/import" method="post" class="form-horizontal">
        <button class="btn btn-success   btn-xs" id="uploadEventBtn2" style="height:26px;"  type="button" >上传</button>
        <input type="file" name="file"   style="width:0px;height:0px;" id="uploadEventFile2">
        <input id="uploadEventPath2"  disabled="disabled"  type="text" placeholder="请择excel表" style="border: 1px solid #e6e6e6; height: 26px;width: 200px;" />
    </form>
</div>
</body>


<div id="content3" style="width: 50%;"  bordercolor="red" >
    <div><p align="center" style="font-family:arial;color:black;font-size:20px;">新增场站</p></div>
    <hr />
    <br/>
    <div>
        所属区域: <input class="username1" style="font-size: 14px;width:200px;height:20px;">
        所属区域: <input class="username2" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>

    <div>
        所属区域: <input class="username3" style="font-size: 14px;width:200px;height:20px;">
        所属区域: <input class="username4" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>
    <div>上传：<input class="username5" style="font-size: 14px;width:500px;height:20px;"></div>
</div>


<div id="content4" style="width: 50%;"  bordercolor="red" >
    <div><p align="center" style="font-family:arial;color:black;font-size:20px;">新增设备</p></div>
    <hr />
    <br/>
    <div>
        所属厂家: <input class="username1" style="font-size: 14px;width:200px;height:20px;">
        设备型号: <input class="username2" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>

    <div>
        属性名称: <input class="username3" style="font-size: 14px;width:200px;height:20px;">
        属性参数: <input class="username4" style="font-size: 14px;width:200px;height:20px;">
    </div><br/>
    <div>所属部件：<input class="username5" style="font-size: 14px;width:500px;height:20px;"></div>
</div>
</body>
</html>
